package com.sino.operation.system.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sino.operation.commons.response.CenterResponseEntity;
import com.sino.operation.entity.BizManagerTrans;
import com.sino.operation.entity.SysCenter;
import com.sino.operation.entity.SysPriority;
import com.sino.operation.service.BizManagerTransService;
import com.sino.operation.service.SysPriorityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Slf4j
@Controller
@RequestMapping("PriorityManager")
@Api(value = "优先级配置管理",tags="优先级配置管理")
public class PriorityManagerController {
    @Autowired
    private SysPriorityService sysPriorityService;


    @GetMapping("/selectList")
    @ApiOperation(value = "查询优先级配置列表")
    @ResponseBody
    public  List<SysPriority>  getPriorityList(@RequestParam Map<String,String> map){
        List<SysPriority> list = sysPriorityService.selectList(map);
        return list;
    }

    @PostMapping("/addPriority")
    @ApiOperation(value = "新增优先级配置")
    @ResponseBody
    public CenterResponseEntity addPriority(SysPriority sysPriority){
        try {
            sysPriorityService.saveOrUpdate(sysPriority);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return CenterResponseEntity.build();
    }

    @PostMapping("/deleteCenter")
    @ApiOperation(value = "删除优先级配置")
    @ResponseBody
    public CenterResponseEntity deletePriority(List ids){
        try {
            sysPriorityService.removeByIds(ids);
        } catch (Exception e) {
            e.printStackTrace();
            return CenterResponseEntity.buildError();
        }
        return CenterResponseEntity.build();
    }




}
